class Role < ActiveRecord::Base

    has_and_belongs_to_many :sites, :join_table => "roles_sites_users"
    has_and_belongs_to_many :users, :join_table => "roles_sites_users"
    
    def self.admin
        return Role.find_first(["name = 'admin'"])
    end
    
    def self.reader
        return Role.find_first(["name = 'reader'"])
    end
    
    def self.editor
        return Role.find_first(["name = 'editor'"])
    end
    
    def self.librarian
        return Role.find_first(["name = 'librarian'"])
    end
    
    def self.stylist
        return Role.find_first(["name = 'stylist'"])
    end
end